package com.flca.frw.config
{
	import com.flca.frw.util.MasterDataUtil;
	
	public class FwMasterData
	{
		private static var roleCodes:Array;
		private static var roleLabels:Array;
		
		public static function initRoles(aMasterXml:XML):void
		{
			roleCodes = new Array();
			roleLabels = new Array();
			
			MasterDataUtil.readMasterItems(aMasterXml, "roles", roleCodes, roleLabels);
		}
		
		public static function getMasterRoleCodes():Array
		{
			return roleCodes;
		}
		
		public static function getMasterRoleLabels():Array
		{
			return roleLabels;
		}
		
		public static function getRoleLabel(aCode:String):String
		{
			return MasterDataUtil.getLabel(aCode, getMasterRoleCodes(), getMasterRoleLabels());
		}
		
		public static function getRoleLabels(aCodes:Array):Array
		{
			var result:Array;
			
			if (aCodes != null)
			{
				result = new Array(aCodes.length);
				for (var i:int = 0; i < aCodes.length; i++)
				{
					result[i] = getRoleLabel(aCodes[i]);
				}
			}
			
			return result;
		}
	}
}